<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

/**
 * App\Models\ItemSkuAttr
 *
 * @property int $attr_id
 * @property string $attr_name
 * @property int $itemid
 * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\ItemSkuValue[] $attrValues
 * @property-read \App\Models\Item $item
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ItemSkuAttr whereAttrId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ItemSkuAttr whereAttrName($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ItemSkuAttr whereItemid($value)
 * @mixin \Eloquent
 */
class ItemSkuAttr extends Model
{
    protected $table = 'item_sku_attr';
    protected $primaryKey = 'attr_id';
    protected $guarded = [];

    public $timestamps = false;

    public function item()
    {
        return $this->belongsTo(Item::class, 'itemid', 'itemid');
    }

    public function attrValues()
    {
        return $this->hasMany(ItemSkuValue::class, 'attr_id', 'attr_id');
    }
}
